package ru.nnstu.client;

import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;

import org.apache.log4j.Logger;

import ru.nnstu.client.gui.ClientViewer;

public class TopicListener implements MessageListener {

  private static final Logger LOG = Logger.getLogger(TopicListener.class);

  @Override
  public void onMessage(Message message) {
    try {
      if (message instanceof ObjectMessage) {
        ObjectMessage mapMessage = (ObjectMessage) message;
        Object obj = mapMessage.getObject();
        
        LOG.info("Receive Object");  
     
//        PlayerCharacterImpl player = obj;
        
        ClientViewer.updateAdd(obj);

      }
    } catch (Exception e) {
    	e.printStackTrace();
    }
  }
}